<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="utf-8"/>
    <title>用户台登录</title>
    <meta name="author" content="DeathGhost"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/style.css}"/>
    <script th:src="@{/js/jquery/jquery.validate.min.js}"></script>
    <script th:src="@{/js/jquery-3.6.0.js}"></script>
    <style>
        body {
            height: 100%;
            background: #16a085;
            overflow: hidden;
        }

        canvas {
            z-index: -1;
            position: absolute;
        }
    </style>
    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/verificationNumbers.js}"></script>
    <script th:src="@{/js/Particleground.js}"></script>
    <script>
        $(document).ready(function () {
            //粒子背景特效
            $('body').particleground({
                dotColor: '#5cbdaa',
                lineColor: '#5cbdaa'
            });

            //验证码
            createCode();
            //测试提交，对接程序删除即可
            $(".submit_btn").click(function () {
                $.ajax({
                    url: "/api/user/user_login",
                    type: "post",
                    data: {
                        username: $("#username").val(),
                        password: $("#password").val()
                    },
                    success: function (result) {
                        if (result.code == 200) {
                            location.href = "/";
                        } else if (result.code == 501) {
                            alert("用户不存在!")
                        } else if (result.code == 502) {
                            alert("密码错误!")
                        }
                    }
                })

            });
        });

    </script>
</head>
<body>
<form id="yzm">
    <dl class="admin_login">
        <dt>
            <strong>用户登陆</strong>
            <em>User Login</em>
        </dt>
        <dd class="user_icon">
            <input type="text" placeholder="账号" class="login_txtbx" id="username" name="username"/>
        </dd>
        <dd class="pwd_icon">
            <input type="password" placeholder="密码" class="login_txtbx" id="password" name="password"/>
        </dd>
        <dd class="val_icon">
            <div class="checkcode">
                <input type="text" id="J_codetext" placeholder="验证码" maxlength="4" class="login_txtbx" name="yzm">
                <canvas class="J_codeimg" id="myCanvas" onclick="createCode()">对不起，您的浏览器不支持canvas，请下载最新版浏览器!</canvas>
            </div>
            <input type="button" value="验证码核验" class="ver_btn" onClick="validate();">
        </dd>
        <dd>
            <input type="button" value="立即登录" class="submit_btn"/>
        </dd>
        <dd>
            <a th:href="@{/api/user/user_register}"><u>还没有账号去注册</u></a>&nbsp;&nbsp;
            <a href="#"><u>忘记密码</u></a>

        </dd>
        <dd>
            <p>© 2015-2016 DeathGhost 版权所有</p>
            <p>陕B2-20080224-1</p>
        </dd>
    </dl>
</form>
</body>
</html>
